/*
 * @Date: 2022-03-14 15:57:54
 * @Description: jest配置文件
 */

const path = require("path");

module.exports = {
  rootDir: path.resolve(__dirname),
  preset: "ts-jest",
  testEnvironment: "jsdom",
  // 配置对应文件转换的方式
  transform: {
    "^.+\\.vue$": "vue-jest",
    "^.+\\js$": "babel-jest",
    "^.+\\.(t|j)sx?$": "ts-jest",
  },
  moduleFileExtensions: ["vue", "js", "json", "jsx", "ts", "tsx", "node"],
  testMatch: [
    "<rootDir>/tests/**/*.spec.ts?(x)",
    "**/tests/**/*.spec.js",
    "**/__tests__/**/*.spec.js",
  ],
  // 目录的别名映射
  moduleNameMapper: {
    "@/(.*)$": "<rootDir>/src/$1",
  },
};
